package com.ym.medical.service.impl;

import com.ym.core.utils.tkmybatis.BaseSVImpl;
import com.ym.medical.dao.CustomTaglibraryDao;
import com.ym.medical.domain.entity.CustomTaglibraryEntity;
import com.ym.medical.domain.param.CustomTaglibraryQueryParam;
import com.ym.medical.domain.param.CustomTaglibraryUpdateParam;
import com.ym.medical.domain.vo.CustomTaglibraryListPcVO;
import com.ym.medical.service.ICustomTaglibrarySV;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 自定义标签库Service业务层处理
 *
 * @author ym
 * @date 2020-08-20
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CustomTaglibrarySVImpl extends BaseSVImpl<CustomTaglibraryEntity, CustomTaglibraryDao> implements ICustomTaglibrarySV {

    /**
     * 查询自定义标签库列表
     *
     * @param queryParam 自定义标签库 查询参数
     * @return 自定义标签库
     */
    @Override
    public List<CustomTaglibraryListPcVO> selectListPC(CustomTaglibraryQueryParam queryParam) {
        List<CustomTaglibraryListPcVO> customTaglibrarys = mapper.selectListPC(queryParam);
        return customTaglibrarys;
    }

    /**
     * 新增自定义标签库
     *
     * @param updateParam 自定义标签库 新增参数
     * @return 结果
     */
    @Override
    public Long insertPC(CustomTaglibraryUpdateParam updateParam) {
        CustomTaglibraryEntity entity = updateParam.covert();
        this.insert(entity);
        return entity.getId();
    }

    /**
     * 修改自定义标签库
     *
     * @param updateParam 自定义标签库 修改参数
     * @return 结果
     */
    @Override
    public int updateByIdPC(CustomTaglibraryUpdateParam updateParam) {
        CustomTaglibraryEntity entity = updateParam.covert();
        int result = this.updateById(entity);
        return result;
    }
}
